function createUser() {
	if(!userBaseMsgForm.getForm().isValid())
		return;
	if(userBaseMsgForm.getForm().findField('password1').lastValue != userBaseMsgForm
		.getForm().findField('password2').lastValue)
		Ext.Msg.alert('错误', '两次密码输入不一致！');
	else {
		userBaseMsgForm.setDisabled(true);
		var id = Ext.create("MyApp.data.MyModelX").data.id.replace(/-/g, "");
		var object = new Object();
		var roleSelectArray = userTabPanel.down('#userHasRolesList')
			.getSelectionModel().getSelected(); // 得到角色被选择的行的数组
		var roleJsonArray = new Array();
		var authJsonArray = new Array();
		object['id'] = id;
		object['userName'] = userBaseMsgForm.getForm().findField('username').lastValue;
		object['realName'] = userBaseMsgForm.getForm().findField('realName').lastValue;
		object['password'] = userBaseMsgForm.getForm().findField('password2').lastValue;
		Ext.each(roleSelectArray.items, function(result) {
			roleJsonArray.push(result.data.id);
		});
		object['roleIds'] = roleJsonArray;
		var json = Ext.JSON.encode(object);
		Ext.Ajax
			.request({
				url: zuulUrl+'/'+authServiceName+'/admin/user',
				method: 'post',
				params: {
					newUserJson: json
				},
				success: function(response, opts) {
					if(response.responseText == 0)
						Ext.Msg.alert('错误', '用户名已存在！');
					else if(response.responseText == 1) {
						Ext.Msg.alert('成功', '添加成功！');
						var record = {
							"id": id,
							"username": userBaseMsgForm.getForm().findField(
								'username').lastValue,
							"realName": userBaseMsgForm.getForm().findField(
								'realName').lastValue,
						};
						Ext.data.StoreManager.lookup('userListStore').add(
							record);
					}
				},
				failure: function(response, opts) {
					console.log('server-side failure with status code ' +
						response.status);
				}
			});
		userBaseMsgForm.setDisabled(false);
	}
}

function updateUser() {
	if(!userBaseMsgForm.getForm().isValid())
		return;
	if(userBaseMsgForm.getForm().findField('password1').lastValue != userBaseMsgForm
		.getForm().findField('password2').lastValue)
		Ext.Msg.alert('错误', '两次密码输入不一致！');
	else {
		userBaseMsgForm.setDisabled(true);
		var id = userList.getSelectionModel().getSelected().items[0].data.id;
		var object = new Object();
		var roleSelectArray = userTabPanel.down('#userHasRolesList')
			.getSelectionModel().getSelected(); // 得到角色被选择的行的数组
		var roleJsonArray = new Array();
		var authJsonArray = new Array();
		object['id'] = id;
		object['userName'] = userBaseMsgForm.getForm().findField('username').lastValue;
		object['realName'] = userBaseMsgForm.getForm().findField('realName').lastValue;
		object['password'] = userBaseMsgForm.getForm().findField('password2').lastValue;
		Ext.each(roleSelectArray.items, function(result) {
			roleJsonArray.push(result.data.id);
		});
		object['roleIds'] = roleJsonArray;
		var json = Ext.JSON.encode(object);
		Ext.Ajax
			.request({
				url: zuulUrl+'/'+authServiceName+'/admin/user',
				method: 'put',
				params: {
					newUserJson: json
				},
				success: function(response, opts) {
					if(response.responseText == 0)
						Ext.Msg.alert('错误', '用户名已存在！');
					else if(response.responseText == 1) {
						Ext.Msg.alert('成功', '修改成功！');
						Ext.data.StoreManager.lookup('userListStore').reload();
					}
				},
				failure: function(response, opts) {
					console.log('server-side failure with status code ' +
						response.status);
				}
			});
		userBaseMsgForm.setDisabled(false);
	}
}